import { Util } from  "../bcat/util/util";
import {GlobalData } from "../global-data";

import {RequestService } from "../bcat/request-service";
import {ITotpInfo } from "../biz/totp-info"
import { VariableStorage} from "../bcat/storage/variable-storage"



//interface for visit the global data
export class Helper{
  util: Util;
  request: RequestService;

  constructor() {
    this.util = new Util();
    this.request = new RequestService()
  }

  getTotpInfo() : ITotpInfo {
    return this.util.getAppArgs<GlobalData, ITotpInfo>("totpInfo");
  }

  getIsTermAgree(): VariableStorage {
    return this.util.getAppArgs<GlobalData, VariableStorage>("vsIsTermAgree");
  }

  getRequest(url:string): any {
    return this.request.post("/cstool/clear")
      .then((res) => {
        console.log('ok:', res);
        return res;
      })
      .catch((err) => {
        console.log('err:',err);
        return err;
      });
  }
}
